package part3;

import java.util.ArrayList;
import java.util.List;


class Student{
	private String name;
	private int finalExam;
	public Student(String n, int fe){
		name = n;
		finalExam = fe;
	}
	public int finalExam(){
		return finalExam;
	}
	public String name(){
		return name;
	}
	public String toString(){
		return name + " " + finalExam;
	}
}



public class Part3 {

	private static int minFinalExam( List<Student> students ) {
		return minFinalExam( students , 0 );
	}
	
	private static int minFinalExam (List<Student> students,int first) {
		int smallest;
		int gradeOfFirst = students.get(first).finalExam();
		if (first == students.size()-1)
			smallest = gradeOfFirst; // the base case
		else { // the general case:
			int minOfRest = minFinalExam(students,first+1);
			if (minOfRest < gradeOfFirst)
				smallest = minOfRest;
			else
				smallest = gradeOfFirst;
		}
		return smallest;
	}

	private static int smallestOf(List<Student> list, int first, int last){
		
		return 0;
	}

	private static void interchange(List<Student> list, int m, int n){
		
	}

	private static void selectionSort ( List<Student> list, int first ) {
		if (first < list.size()) {
			int small =	smallestOf(list,first,list.size()-1);
			interchange(list,first,small);
			selectionSort(list,first+1);
		}
	}
	
	public static void main(String[] args) {
		ArrayList<Student> list = new ArrayList<Student>();
		list.add( new Student("Camila" , 153 ));
		list.add( new Student("James" , 146 ));
		list.add( new Student("Jake" , 142 ));
		list.add( new Student("Lindsey" , 145 ));
		list.add( new Student("Thiago" , 135 ));
		list.add( new Student("Brandon" , 143 ));
		
		System.out.println("List: " + list );
		
		selectionSort( list, 0 );

		System.out.println("Sorted List: " + list );
		
	}
}
